/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.nio.charset.StandardCharsets;

/**
 * <p>Project: javase2203 - Demo
 * <p>Powered by webrx On 2022-07-12 14:17:14
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Demo {
    public static void main(String[] a) {
        //System.out.println(System.getProperty("java.version"));
        //.length是数组对象的属性，后边没有括号  .length()是错误的，因为数组对象没有.length（）方法
        System.out.println(a.length);

        //字符串对象有.length() 方法，用于返回这个字符串的字符个数
        System.out.println("hello中国人".length());//字符个数
        System.out.println("hello中国人".getBytes().length);//字节数


        int x = 0;
        int y = 0;
        if(a.length == 2) {
            x = Integer.parseInt(a[0]);
            y = Integer.parseInt(a[1]);
        }
        System.out.printf("%d + %d = %d %n",x,y,x+y);
    }
}
